<?php
/**
 * Create By: PhpStorm
 * User: niechenguang
 * File: Circle.php
 * Date: 2017/1/2
 * Time: 23:13
 */
namespace app\api\model\dao;

use app\library\Flag;
use think\Model;
use think\Db;

class NoteAccusation extends Model
{
    protected $table = 'note_accusation';

    protected $pk = 'id';

    public function add($arrInput)
    {
        unset($arrInput[$this->pk]);

        $this->data($arrInput);
        $this->save();
        return $this->data[$this->pk];
    }

    public function getDataByNoteidUserid($note_id, $userid)
    {
        $conds = [
            'note_id' => ['=', $note_id],
            'userid' => ['=', $userid],
        ];

        $ret = Db::table($this->table)->where($conds)->select();
        if (!empty($ret)) {
            return $ret[0];
        }
        return [];
    }

}
